<?php
    $user =  $this->session->userdata('username');
    $page='login';
    if($user!=''){
        $page='home';
    }

?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>AddMob</title>
         
        <link rel="stylesheet" href="styles/jquery.mobile.css"/>
        <link rel="stylesheet" href="styles/jquery.mobile.theme.css"/>
        <!--<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" />-->
        <link rel="stylesheet" href="js/jquery.ui.plupload.css" type="text/css" />
        <link rel="stylesheet" href="js/jquery.plupload.queue.css" type="text/css" />

        <script type="text/javascript" src="/js/modernizr.js"></script>
        
        <script type="text/javascript" src="/js/jquery.js"></script>
        <!--pupload debug scripts-->
        <script type="text/javascript" src="js/jquery.mobile.js"></script>
        <script type="text/javascript" src="js/mobile.js"></script>
         <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>-->
        <script type="text/javascript" src="js/moxie.js"></script>
        <script type="text/javascript" src="js/plupload.full.min.js"></script>
       <!-- <script type="text/javascript" src="js/jquery.plupload.queue.min.js"></script>-->

        <script>
          /*  $(document).bind("mobileinit", function () {
                $.mobile.ajaxEnabled = false;
            })*/
        </script>
        
       

        <script>
            /*  $(function () {
            var eventList;
            var createEventList = function (page) {
            var list = "<ul data-role='listview' data-filter='true' class='catlist'>";
            $("#clist").html()

            list.listview();
            return list;
            }

            var addToList = function (message) {
            $("<li>").text(message).appendTo(eventList);
            eventList.listview("refresh");
            };

            $(document).bind("swipeleft", function () {
            addToList("swipeleft");
            });

            $(window).bind("orientationchange", function (event) {
            addToList(event.orientation);

            });

            $(document).bind("pagechange", function (event, ui) {
            eventList = $(".catlist", ui.toPage);
            if (eventList.length == 0) {
            eventList = createEventList(ui.toPage);
            }
            });
            });*/
            //

            $(function () {
                var message = "";
                if (Modernizr.localstorage) {
                    message = "localStorage supported"
                } else {
                    message = "localStorage not supported";
                }

                

                loadPage(<?php echo json_encode($page)?>);

            });


           

            $(document).bind("pagechange", function (event, ui) {
                console.log("pagechange called");
                console.log(ui.toPage);
                var pageTo = ui.toPage.attr('id');

                var url = location.protocol + '//' + location.host;
                //plupload script
               


                $('#addtypes ul').children('li').off('vclick').on('vclick', function () {
                    loadTypeCategories($(this).attr('data-name'));
                })//end of category children click event

                $('#category_t-0001 ul').children('li').off('vclick').on('vclick', function () {
                    loadCategoryItems($(this).attr('data-name'));
                })//end of category children click event

                $('#category_t-0002 ul').children('li').off('vclick').on('vclick', function () {
                    loadCategoryItems($(this).attr('data-name'));
                })

                $('#category_t-0003 ul').children('li').off('vclick').on('vclick', function () {
                    loadCategoryItems($(this).attr('data-name'));
                })

                $('#cart_items ul').children('li').off('vclick').on('vclick', function () {
                    deleteItemFromCart($(this).attr('data-name'));
                })

                /* $("#catSizesBtn").off('vclick').on('vclick', function () {
                var size = $('#catSelected').val();
                console.log("loading sizes for category=" +size );
                });*/

                initUploader();



            })


           
        </script>
        

        


    </head>
    <body>
        <div id="master_page">

         <!--login page-->
      <div data-role="page" id="login">
     <div data-role="header">
             <h1>Ripplr</h1>
               
           </div>

            <div data-role="content">
            <form id="loginform" data-ajax="false">
                <input type="text" placeholder="email" name="uname" id="uname"/>
                <input type="password" placeholder="password" name="pass" id="pass"/>
                <a id='login' data-role ="button" data-theme="b"  onclick='login()'>signin</a>
             </form>
            </div>
            <div data-role="footer" data-position="fixed">
            <h3>Powered By Tekmonkeys</h3>
            </div>
     </div><!--end of login page-->   
        
       <!--Initial page-->
       <div data-role="page" id="home">
           <div data-role="header">
             <h1>Ripplr</h1>
               
           </div>

            <div data-role="content">
               <a href="#category" data-role="button" data-theme="b" onclick="loadAddTypes()">Post An Ad</a>
               
            </div>
            <div data-role="footer" data-position="fixed">
            <h3>Powered By Tekmonkeys</h3>
            </div>
        </div>
       

        
            <input type='hidden' id='catSelected' name='catSelected'/>
            <input type='hidden' id='typeSelected' name='typeSelected'/>
            <input type="hidden" id="prodSelected" name="prodSelected"/>

               </div><!--end of master page-->
        <form>

    

</form>

    </body>
</html>
